package lock;

public class DeadThreadB implements Runnable {

    private String lock1;
    private String lock2;

    public DeadThreadB(String lock1, String lock2) {
        this.lock1 = lock1;
        this.lock2 = lock2;
    }

    @Override
    public void run() {
        while (true) {
            synchronized (lock2) {
                System.out.println("B:lock2正在运行.....");
                synchronized (lock1) {
                    System.out.println("B:lock1继续运行.....");
                }
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
